package com.jing.system.comm.enums;

import java.util.LinkedHashMap;
import java.util.Map;

import com.jing.system.comm.contants.SystemCons;

/**
 * 发送微博
 * @author jing.yue
 * @version 1.0
 * @since 2012-10-13
 */
public enum UpdateStatusWeiboType {
	/** 签到 */
	TYPE_SIGN("sign", RuleType.TYPE_SEND_WEIBO, SystemCons.getUserSignContent(RuleType.TYPE_EVERY_SIGN_IN));

	private String code;
	
	private RuleType ruleType;

	private String text;

	public static Map<String, UpdateStatusWeiboType> map;

	public static Map<String, UpdateStatusWeiboType> init(){
		if(map == null){
			map = new LinkedHashMap<String, UpdateStatusWeiboType>();
			map.put(TYPE_SIGN.code, TYPE_SIGN);
		}
		return map;
	}

	/**
	 * 根据Code获取UpdateStatusWeiboType对象
	 * @param code
	 * @return
	 */
	public static UpdateStatusWeiboType getCodeByUpdateStatusWeiboType(String code) {
		init();
		return map.get(code);
	}

	public static Map<String, UpdateStatusWeiboType> getMap() {
		init();
		return map;
	}

	private UpdateStatusWeiboType(String code, RuleType ruleType, String text) {
		this.code = code;
		this.ruleType = ruleType;
		this.text = text;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public RuleType getRuleType() {
		return ruleType;
	}

	public void setRuleType(RuleType ruleType) {
		this.ruleType = ruleType;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}
}